Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add examples/ directory #98

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

ctrlcctrlv
Copy link
Contributor

Promised in main README. Hopefully the beginning of many examples that don't require network connectivity.

@Reino17
Copy link

Reino17 commented Jan 28, 2023

xquery version "3.1"; [...] parse-xml('<html>...</html>')

xquery version "3.1-xidel"; [...] parse-html('<html>...</html>') (parse-html())

xidel --html --xquery3="$(cat examples/1.xq)"

There's --extract-file or -e @ for that, and --output-node-indent for some prettification:

xidel -s --extract-file="examples/1.xq" --output-format=html --output-node-indent
xidel -s -e @"examples/1.xq" --output-format=html --output-node-indent
<!DOCTYPE html>
<table>
  <tbody>
    <tr class="C_123 hascol1" id="123">
      <td>123</td>
      <!--  -->
    </tr>
    <tr class="C_456 C_other hascol1 hascomment" id="456">
      <td>456</td>
      <!-- other -->
    </tr>
    <tr class="C_foo C_columns hascol1 hascomment" id="foo">
      <td>foo</td>
      <!-- columns -->
    </tr>
    <tr class="C_bar C_are hascol1 hascomment" id="bar">
      <td>bar</td>
      <!-- are -->
    </tr>
    <tr class="C_xyz C_ignored C_zomg hascol1 hascomment zomg" id="xyz">
      <td name="zomg">xyz</td>
      <!-- ignored -->
    </tr>
  </tbody>
</table>

However, I think the wiki is a much better place for examples. It's still on my long to-do-list. And let's then start off with some easy examples first, because let's face it, this particular example is really for the advanced Xidel-user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants